#include <QByteArray>
#include <QXmlAttributes>
#include <QXmlStreamReader>
#include <QString>
#include <QDebug>
#include <QDateTime>

#include "kukaforcecontrolbackend.h"
#include "Package/kukarsiudpserverdll_global.h"
#include "Package/simpletcpsocketdll_global.h"
#include "Package/sriforcesensordll_global.h"
#include "Package/kukarsittsdll_global.h"

visualkukarobotbackend::visualkukarobotbackend(){
    this->mSRIForceSensor = GetSRIForceSensorInstance();
    this->mKuKaRsiTTS = GetKuKaRsiTTSInstance();
}

visualkukarobotbackend::~visualkukarobotbackend(){

}

short visualkukarobotbackend::KUKAProcess(){
    if( this->mKuKaRsiTTS->KUKADataRecv()){
/*************USERCODE-BEGIN****************/

/**************USERCODE-END*****************/
        this->mKuKaRsiTTS->KUKADataSend();
        return 1;
    }
    return 0;
}

short visualkukarobotbackend::getKUKARIst(double (&KUKARIst)[6]){
   return this->mKuKaRsiTTS->getKUKARIst(KUKARIst);
}
short visualkukarobotbackend::getKUKAAIst(double (&KUKAAIst)[6]){
   return this->mKuKaRsiTTS->getKUKAAIst(KUKAAIst);
}
short visualkukarobotbackend::getKUKAATor(double (&KUKAATor)[6]){
   return this->mKuKaRsiTTS->getKUKAATor(KUKAATor);
}
short visualkukarobotbackend::setKUKARTTS(double KUKARTTS[6]){
   return this->mKuKaRsiTTS->setKUKARTTS(KUKARTTS);
}

short visualkukarobotbackend::ForceSensorConnect(){
    return this->mSRIForceSensor->ForceSensorConnect("192.168.1.108",4008);
}
short  visualkukarobotbackend::ForceSensorLoopRun(){
    this->mSRIForceSensor->ForceSensorLoopRun();
    return NOERROR;
}
short  visualkukarobotbackend::ForceSensorZeroDeal(){
    this->mSRIForceSensor->ForceSensorZeroDeal();
    return NOERROR;
}
short visualkukarobotbackend::ReadForceSensorData(double (&Data)[6]){
    return this->mSRIForceSensor->ReadForceSensorData(Data);
}
